﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using WarehouseWebAPP.code.BLL;
using AjaxControlToolkit;

namespace WarehouseWebAPP.Pages.user.New_Entities
{
    public partial class NewDelivery : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {

        }

        protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
        {
            ComponentBLL BLL = new ComponentBLL();
            Guid component = new Guid(((ComboBox)DeliveredDetailsView.FindControl("ComboBox1")).SelectedValue);

            try
            {
                if (BLL.ComponentGetQuantityByNum(component) < System.Convert.ToInt32(args.Value, 10))
                    args.IsValid = false;
                else
                    args.IsValid = true;
            }
            finally
            {
                //TODO: Dispose
            }
        }
    }
}
